const box = document.querySelector('#box1')
const box2 = document.querySelector('#box2')
const gread = document.querySelector('#gread')

box.addEventListener('click', function (e) {
  // e.clientX 鼠标触发时的x轴坐标
  // this.offsetLeft 相对于body左边缘距离
  let width = e.clientX - this.offsetLeft
  box2.style.width = width + 'px'
  
  let greadStr = Math.round(width / 5)
  
  gread.innerHTML = `${greadStr}分`
  
})